<{include file="tpl/header.html"}>

<h2 class="ytadmin-h2">链接列表
<a class="pull-right btn btn-info" href="<{spUrl c=url a=opera cat_id=$cat_id}>">添加链接</a>
</h2>
<div class="clearfix ytadmin-search-box">
<form class="form-inline" role="form" action="<{spUrl c=url a=index}>" method="post">
	<div class="form-group">
		<label class="sr-only" for="s_content">搜索内容</label>
      	<input class="form-control" type="text" id="s_content" name="s_content" value="<{$data_return['s_content']}>" placeholder="搜索内容"/>
    </div>
    <div class="form-group">
    	<label class="sr-only" for="s_cat_id">搜索分类</label>
      	<select name="cat_id" id="s_cat_id" class="form-control">
				<option value="0">全部分类</option>
		<{foreach key=key item=cat_item from=$cat_result}>
			<{if $data_return['cat_id']==$cat_item['id']}>
				<option value="<{$cat_item['id']}>" selected="selected"><{$cat_item['name']}></option>
			<{else}>
				<option value="<{$cat_item['id']}>"><{$cat_item['name']}></option>
			<{/if}>
		<{/foreach}>
	  	</select>
	</div>
	<div class="form-group">
      	<input class="btn btn-info" type="submit" name="s_submit" value="搜索">
    </div>
</form>
</div>
<div class="ytadmin-table-wrap">
	<h3>
	<{if $data_return['s_submit']}>
		关于"<{$data_return['s_content']}>"的搜索结果
	<{/if}>
	</h3>
	<table class="table table-striped">
		<tr>
			<th>标题</th>
			<th>浏览</th>
			<th>日期</th>
			<th>排序</th>
			<th>可见性</th>
			<th>操作</th>
		</tr>
	<{foreach item=url_item from=$url_result}>
		<tr>
			<td>
				<a target="_blank" title="预览" href="#"><{$url_item['title']|truncate:26:'...'}></a>
			</td>
			<td>
				<{$url_item['view_num']}>
			</td>
			<td>
				<{$url_item['add_time']}>
			</td>
			<td>		
				<form class="form-inline"  action="<{spUrl c=url a=index cat_id=$cat_id}>" method="post">		
					<div class="form-group">
						<input type="text" name="weight" class="form-control input-sm ytadmin-input-min" value="<{$url_item['weight']}>" />
					</div>
					<div class="form-group">		
						<input type="hidden" name="url_id" value="<{$url_item['id']}>"/>						
						<input type="submit" name="url_update" class="btn btn-sm" value="更新"/>
					</div>
				</form>
			</td>
			<td>
				<div class="btn-group">
					<{if $url_item['visible']}>
						<a class="btn btn-info btn-sm">显示</a>
						<a href="<{spUrl c=url a=index cat_id=$cat_id url_id=$url_item['id'] url_update=1 visible=0}>" class="btn btn-default btn-sm">隐藏</a>
					<{else}>
						<a href="<{spUrl c=url a=index cat_id=$cat_id url_id=$url_item['id'] url_update=1 visible=1}>" class="btn btn-default btn-sm">显示</a>
						<a href="" class="btn btn-info  btn-sm">隐藏</a>
					<{/if}>
				</div>					
			</td>
			<td>
				
				<a class="btn btn-info btn-sm" title="更新" href="<{spUrl c=url a=opera update_url_id=$url_item['id'] cat_id=$cat_id}>">更新</a>
				<a class="btn btn-warning btn-sm" title="删除" href="<{spUrl c=url a=index delete_url_id=$url_item['id'] cat_id=$cat_id}>">删除</a>
			</td>
		</tr>
	<{foreachelse}>
		<tr><td colspan="6">此分类下连一个链接也没有！</td></tr>
	<{/foreach}>
	</table>
	
	<{include file="tpl/pagination.html"}>
	
</div>

<{include file="tpl/footer.html"}>